package org.thirdHero.sys.domain;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * 表名 sys_storage
 * @author Administrator
 * @创建时间： 2019-07-17
 */
public class SysStorage {
    /**
     * 
     */
    private Integer id;

    /**
     * 
     */
    private String key;

    /**
     * 文件名
     */
    private String name;

    /**
     * 文件类型
     */
    private String type;

    /**
     * 文件大小
     */
    private Integer size;

    /**
     * 最后更新时间
     */
    private LocalDateTime modifyDate;

    /**
     * 资源链接
     */
    private String url;

    /**
     * 添加时间
     */
    private LocalDateTime createDate;

    /**
     * 是否删除
     */
    private Boolean deleted;

    /**
     * 缩略图
     */
    private String thumbnailUrl;

    /**
     * 备注信息
     */
    private String remark;

    /**
     * 所属人id
     */
    private String ownId;

    /**
     * 使用的类别
     */
    private String groups;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    /**
     * 文件名
     * @return name 文件名
     */
    public String getName() {
        return name;
    }

    /**
     * 文件名
     * @param name 文件名
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 文件类型
     * @return type 文件类型
     */
    public String getType() {
        return type;
    }

    /**
     * 文件类型
     * @param type 文件类型
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * 文件大小
     * @return size 文件大小
     */
    public Integer getSize() {
        return size;
    }

    /**
     * 文件大小
     * @param size 文件大小
     */
    public void setSize(Integer size) {
        this.size = size;
    }

    /**
     * 最后更新时间
     * @return modify_date 最后更新时间
     */
    public LocalDateTime getModifyDate() {
        return modifyDate;
    }

    /**
     * 最后更新时间
     * @param modifyDate 最后更新时间
     */
    public void setModifyDate(LocalDateTime modifyDate) {
        this.modifyDate = modifyDate;
    }

    /**
     * 资源链接
     * @return url 资源链接
     */
    public String getUrl() {
        return url;
    }

    /**
     * 资源链接
     * @param url 资源链接
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * 添加时间
     * @return create_date 添加时间
     */
    public LocalDateTime getCreateDate() {
        return createDate;
    }

    /**
     * 添加时间
     * @param createDate 添加时间
     */
    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    /**
     * 是否删除
     * @return deleted 是否删除
     */
    public Boolean getDeleted() {
        return deleted;
    }

    /**
     * 是否删除
     * @param deleted 是否删除
     */
    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    /**
     * 缩略图
     * @return thumbnail_url 缩略图
     */
    public String getThumbnailUrl() {
        return thumbnailUrl;
    }

    /**
     * 缩略图
     * @param thumbnailUrl 缩略图
     */
    public void setThumbnailUrl(String thumbnailUrl) {
        this.thumbnailUrl = thumbnailUrl;
    }

    /**
     * 备注信息
     * @return remark 备注信息
     */
    public String getRemark() {
        return remark;
    }

    /**
     * 备注信息
     * @param remark 备注信息
     */
    public void setRemark(String remark) {
        this.remark = remark;
    }

    /**
     * 所属人id
     * @return own_id 所属人id
     */
    public String getOwnId() {
        return ownId;
    }

    /**
     * 所属人id
     * @param ownId 所属人id
     */
    public void setOwnId(String ownId) {
        this.ownId = ownId;
    }

    /**
     * 使用的类别
     * @return groups 使用的类别
     */
    public String getGroups() {
        return groups;
    }

    /**
     * 使用的类别
     * @param groups 使用的类别
     */
    public void setGroups(String groups) {
        this.groups = groups;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", key=").append(key);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", size=").append(size);
        sb.append(", modifyDate=").append(modifyDate);
        sb.append(", url=").append(url);
        sb.append(", createDate=").append(createDate);
        sb.append(", deleted=").append(deleted);
        sb.append(", thumbnailUrl=").append(thumbnailUrl);
        sb.append(", remark=").append(remark);
        sb.append(", ownId=").append(ownId);
        sb.append(", groups=").append(groups);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysStorage other = (SysStorage) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getKey() == null ? other.getKey() == null : this.getKey().equals(other.getKey()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getSize() == null ? other.getSize() == null : this.getSize().equals(other.getSize()))
            && (this.getModifyDate() == null ? other.getModifyDate() == null : this.getModifyDate().equals(other.getModifyDate()))
            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
            && (this.getThumbnailUrl() == null ? other.getThumbnailUrl() == null : this.getThumbnailUrl().equals(other.getThumbnailUrl()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getOwnId() == null ? other.getOwnId() == null : this.getOwnId().equals(other.getOwnId()))
            && (this.getGroups() == null ? other.getGroups() == null : this.getGroups().equals(other.getGroups()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getKey() == null) ? 0 : getKey().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getSize() == null) ? 0 : getSize().hashCode());
        result = prime * result + ((getModifyDate() == null) ? 0 : getModifyDate().hashCode());
        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getThumbnailUrl() == null) ? 0 : getThumbnailUrl().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getOwnId() == null) ? 0 : getOwnId().hashCode());
        result = prime * result + ((getGroups() == null) ? 0 : getGroups().hashCode());
        return result;
    }

    /**
     * sys_storage
     */
    public enum Column {
        id("id", "id", "INTEGER", false),
        key("key", "key", "VARCHAR", true),
        name("name", "name", "VARCHAR", true),
        type("type", "type", "VARCHAR", true),
        size("size", "size", "INTEGER", true),
        modifyDate("modify_date", "modifyDate", "TIMESTAMP", false),
        url("url", "url", "VARCHAR", false),
        createDate("create_date", "createDate", "TIMESTAMP", false),
        deleted("deleted", "deleted", "BIT", false),
        thumbnailUrl("thumbnail_url", "thumbnailUrl", "VARCHAR", false),
        remark("remark", "remark", "VARCHAR", false),
        ownId("own_id", "ownId", "VARCHAR", false),
        groups("groups", "groups", "VARCHAR", false);

        /**
         */
        private static final String BEGINNING_DELIMITER = "`";

        /**
         */
        private static final String ENDING_DELIMITER = "`";

        /**
         */
        private final String column;

        /**
         */
        private final boolean isColumnNameDelimited;

        /**
         */
        private final String javaProperty;

        /**
         */
        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            return this.getEscapedColumnName();
        }
    }
}